<?php

$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);

socket_bind($sock, '0.0.0.0', 9501);

socket_recvfrom($sock, $buf, 1024, 0, $from, $port);

socket_close($sock);

echo "client ip: $from\n";
echo "client port: $port\n";

$buf = trim($buf);
echo "received data: $buf \n";

